﻿Public Class BLLItensRecurso
    Dim objDAO As DALItensRecurso
    Private itecodigo As Integer
    Private objRecurso As BLLRecurso
    Public Function excluirTodos() As Boolean  'esta ok
        Dim retorno As Boolean
        Try
            objDAO = New DALItensRecurso
            objDAO.excluirTodos(Me.itecodigo)
            retorno = True
        Catch ex As Exception
            retorno = False
            Throw ex
        Finally
            objDAO = Nothing
        End Try
        Return retorno
    End Function
    Public Property pitecodigo As Integer
        Get
            Return Me.itecodigo
        End Get
        Set(ByVal value As Integer)
            Me.itecodigo = value
        End Set
    End Property
    Public Property pobjRecurso As BLLRecurso
        Get
            Return Me.objRecurso
        End Get
        Set(ByVal value As BLLRecurso)
            Me.objRecurso = value
        End Set
    End Property
    Public Function localizarTodos() As DataTable
        Dim tab As DataTable
        Try
            objDAO = New DALItensRecurso
            tab = objDAO.localizarTodos(Me.itecodigo)
        Catch ex As Exception
            Throw ex
        Finally
            objDAO = Nothing
        End Try
        Return tab
    End Function
    Public Function inserir() As Boolean
        Dim retorno As Boolean
        Try
            objDAO = New DALItensRecurso
            objDAO.inserir(Me.itecodigo, Me.objRecurso.pcodigo)
            retorno = True
        Catch ex As Exception
            retorno = False
            Throw ex
        Finally
            objDAO = Nothing
        End Try
        Return retorno
    End Function

End Class
